package net.huashitong.Project.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.sirdc.modules.core.dao.GenericQuery;
import com.sirdc.modules.core.dao.StringDao;

import net.huashitong.Project.entity.Files;

@Repository
public class FilesDao extends StringDao<Files> {
	
	public List<Files> query(String projectId,String nodeId){
		GenericQuery query = createQuery("obj");
		query.append(" and obj.projectId=:projectId").setParam("projectId", projectId);
		query.append(" and obj.nodeId=:nodeId").setParam("nodeId", nodeId);
		return query.listResult();
	}
	public List<Files> queryByAcceptId(String projectId,String acceptNodeId){
		GenericQuery query = createQuery("obj");
		query.append(" and obj.projectId=:projectId").setParam("projectId", projectId);
		query.append(" and obj.acceptNodeId=:acceptNodeId").setParam("acceptNodeId", acceptNodeId);
		return query.listResult();
	}
	public List<Files> queryBySendId(String projectId,String sendNodeId){
		GenericQuery query = createQuery("obj");
		query.append(" and obj.projectId=:projectId").setParam("projectId", projectId);
		query.append(" and obj.sendNodeId=:sendNodeId").setParam("sendNodeId", sendNodeId);
		return query.listResult();
	}
	public List<Files> queryByProjectId(String projectId){
		GenericQuery query = createQuery("obj");
		query.append(" and obj.projectId=:projectId").setParam("projectId", projectId);
	
		return query.listResult();
	}
}
